<template>
	<view>
		<u-toast ref="uToast" />
		<view class="relocation-content empty">
			<view class="relo-header">
				<uni-forms ref="form" :modelValue="params" :label-width="50">
					<uni-forms-item label="容器条码" name="contNo" label-align="right" :label-width="70">
						<uni-easyinput ref="inputSelect" size="small" id="inputSelect" focus trim="all"
							@focus="_inputFocus" v-model="params.contNo" maxlength="8"
							placeholder="请输入容器条码"></uni-easyinput>
					</uni-forms-item>
					<uni-forms-item label="站台名称" label-align="right" :label-width="70">
						<uni-data-select v-model="params.stationNo" :localdata="range"
							placeholder="请选择入库站台"></uni-data-select>
					</uni-forms-item>
				</uni-forms>
				
			</view>
		</view>
		<button class="next" type="primary" @click="inConfirm">登记入库</button>
	</view>
</template>
</script>
<script>
	import {
		emptyRegister
	} from '@/api/request.js'
	export default {
		name: 'rf-form',
		data() {
			return {
				params: {
					contNo: '',
					stationNo: ''
				},
				range: [{
						value: '1F_IN_ST11',
						text: "料箱入库区"
					},
					{
						value: '1F_IN_ST12',
						text: "托盘入库区"
					}
				],
			};
		},
		methods: {
			_inputFocus() {
				document.querySelector('#inputSelect input').select()
			},
			inConfirm() {
				if (!this.params.contNo) {
					uni.showModal({
						title: '失败提示',
						confirmColor:'#F54E40',
						showCancel: false,
						content: '请输入或扫码容器条码！',
					})
					return
				}
				if (!this.params.stationNo) {
					uni.showModal({
						title: '失败提示',
						confirmColor:'#F54E40',
						showCancel: false,
						content: '请选择入库站台！',
					})
					return
				}
				emptyRegister(this.params, (res) => {
					if (res.code == 0) {
						uni.showModal({
							title: '成功信息',
							confirmColor:'#00ff00',
							showCancel: false,
							content: res.data,
						})
						this.params.contNo = ''
					} else {
						console.log(res);
						uni.showModal({
							title: '失败提示',
							confirmColor:'#F54E40',
							showCancel: false,
							content: res.msg,
						})
					}

				})
			}
		}
	}
</script>

<style lang="scss">
	@import url("@/static/styles/form.scss");
</style>
<style scoped>
	::v-deep .is-disabled {
		color: black;
	}

	.relocation-content .relo-header {
		padding-bottom: 0;
	}

	.unit {
		margin-right: 5px;
	}

	.empty .uni-forms {
		overflow: visible;
	}
</style>